package edu.luc.concordia;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.EventListenerList;

/**
 * Copyright 2008 Project Concordia
 * <p>
 * This file is part of RetailReturnSystem.
 * <p>
 * RetailReturnSystem is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * <p>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * <p>
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
 * <hr>
 * 
 * @author Rashmi Pandey 
 * @version 2.0 NOV-21-2008
 *  
 * This method creates Returns GUI for the retail return system.
 */


public class SystemReturns extends JPanel implements ActionListener{
	
    private javax.swing.JButton receiptDoneButton;
    private javax.swing.JButton productDoneButton;
    private javax.swing.JButton returnButton;
    private javax.swing.JButton cancelButton;
    private javax.swing.JLabel receiptLabel;
    private javax.swing.JLabel productLabel;
    private javax.swing.JLabel returnInfoLabel;
    private javax.swing.JLabel refundLabel;
    private javax.swing.JLabel dollarLabel;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea returnTextArea;
    private javax.swing.JTextField receiptTextField;
    private javax.swing.JTextField productTextField;
    private javax.swing.JTextField refundTextField;
	private JFrame frame;
	
	private EventListenerList listenerList = new EventListenerList();
    
    /** This method is called from within the constructor to
     * initialize the form.
     * 
     */
     public SystemReturns(JFrame frame) {
    	this.frame = frame;
 		this.setLayout(new BorderLayout());
 		JPanel displayPanel = new JPanel();
 		displayPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); 
    	 
        receiptLabel = new javax.swing.JLabel();
        receiptTextField = new javax.swing.JTextField();
        receiptDoneButton = new javax.swing.JButton();
        productLabel = new javax.swing.JLabel();
        productTextField = new javax.swing.JTextField();
        productDoneButton = new javax.swing.JButton();
        returnInfoLabel = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        returnTextArea = new javax.swing.JTextArea();
        refundLabel = new javax.swing.JLabel();
        refundTextField = new javax.swing.JTextField();
        dollarLabel = new javax.swing.JLabel();
        returnButton = new javax.swing.JButton();
        cancelButton = new javax.swing.JButton();

        receiptLabel.setText("Receipt ID : ");
        receiptDoneButton.setText("Done");
        productLabel.setText("Product ID : ");
        productDoneButton.setText("Done");
        returnInfoLabel.setText("Return Information : ");
        returnTextArea.setColumns(20);
        returnTextArea.setRows(15);
        jScrollPane1.setViewportView(returnTextArea);
        setText(DateUtils.now() + "\n----------------------------------- \n" + 
				"\n\n\n THANK YOU !");
		
        
        refundLabel.setText("Refund : ");
        dollarLabel.setText("Dollars");
        returnButton.setText("Return Done");
        cancelButton.setText("Cancel");
        
        /**
         * Set all the buttons, TextArea in the Layout.
         */    
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
            this.setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(32, 32, 32)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(refundLabel)
                            .addGap(36, 36, 36)
                            .addComponent(refundTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(dollarLabel))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(returnInfoLabel)
                            .addGap(18, 18, 18)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(receiptLabel)
                                .addComponent(productLabel))
                            .addGap(20, 20, 20)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(productTextField)
                                .addComponent(receiptTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE))
                            .addGap(37, 37, 37)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(receiptDoneButton)
                                .addComponent(productDoneButton))))
                    .addContainerGap(52, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addGap(97, 97, 97)
                    .addComponent(returnButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 96, Short.MAX_VALUE)
                    .addComponent(cancelButton)
                    .addGap(85, 85, 85))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(22, 22, 22)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(receiptLabel)
                        .addComponent(receiptTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(receiptDoneButton))
                    .addGap(21, 21, 21)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(productLabel)
                        .addComponent(productTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(productDoneButton))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(52, 52, 52)
                            .addComponent(returnInfoLabel))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(23, 23, 23)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(refundLabel)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(refundTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(dollarLabel)))
                    .addGap(17, 17, 17)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(cancelButton)
                        .addComponent(returnButton))
                    .addContainerGap())
          );
     }
    
     /**
      * Set the return text area to have the string.
      * @param str
      */
    public void setText(String str)
 	{ 		
    	 returnTextArea.setText(str);
 	}
     
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
	}
	
	/**
	 * Add all listener into a list of listeners.
	 * @param l is a action listener from GUI.
	 */
	public void addActionListener(ActionListener l)
	{
		listenerList.add(ActionListener.class, l);
	}

	
}
